X(X1,…..,Xn) iid –> loi normale N(u,o) + Loi uniforme U([-a;a])
Generation d’un echantillon de taille n= 10 pour unr valeur Teta fixe
Ce modele permet de gerer les valeurs aberantes automatiquement.
Em va permettre de resoudre numeriquement ce type de probleme ou une variable n’est pas reelelemtn connue (VARIABLE CACHE), ici c’est la provenance du x, est-ce une gaussienne ou une loie uniforme.
n=100
a = 5
c= 1/(2*a)
teta = 10
mu = 0
sigma = 1
pi = 0.9
prop = rbinom(n, 1, pi)
prop
[1] 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1
[63] 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1
Dans un premier temps on genere la proportion de variables qui vont etre generer par loi normale et loi uniforme. Pour cela, tirage aleatoire de bernouilli. Ici 90% vont etre generee par une varibale normale et 10% par unirfome, ces 10% correspondent aux valeurs aberantes qu’on veut generer.
ifelse() = for et if en une seule fois, parcours tableau et fonctionne comme un ternaire.
x <- ifelse(prop == 1, rnorm(n, mu, sigma), runif(n, -a, a))
x <- y * rnorm(n, mu, sigma) + (1-y) * runif(n, -a, a) Fonctionne de la meme maniere
Diagramme en boite
boxplot(x)
Typiquement, la presence des valeurs aberantes est du au melange. Si on avait qu’une loi normale, on n’aurait pas ces valeurs. Ainsi pour faire de l’apprentissage en se basant sur une loi normale, il faut pas de valeur aberante. EM va permettre de les corriger.
Recherche des valeurs aberantes
which(x < -4)
[1] 75 81
x[which(x < -4)]
[1] -4.971360 -4.694309
prop[which(x < -4)]
[1] 0 0
On verifie ainsi que ces valeurs aberantes proviennents bien de la loi uniforme.
Explication EM calculs
dunif(x,-a,a) = c dans un cas plus general
mum = 9
sigmam = 8
pim = 0.2
tol = 1e-200
qim <- rep(1,n)
it = 0
while (TRUE){
it = it + 1
qi <- qim
qim = (dnorm(x,mum,sigmam)*pim) / (dnorm(x,mum,sigmam)*pim + (1-pim)*dunif(x,-a,a))
if (mean((qi-qim)^2) < tol)
break
pim = mean(qim)
mum = sum(qim*x)/sum(qim)
sigmam = sqrt((sum(qim*(x-mum)^2))/sum(qim))
}
mum
[1] -0.03713645
sigmam
[1] 0.848623
pim
[1] 0.8629525
it
[1] 126
Estimation naive (sans prendre en compte les valeurs aberantes), comme si les valeurs etaient une loi uniforme parfaite.
mean(x)
[1] 0.006945389
sd(x)
[1] 1.358401
Em arrive bien a retrouver le vrai ecart type par rapport a l’estimation naive
plot(x, 1-qi)
C’est la probabilite que la valeur soit aberantes (i.e issue de la loie uniforme) –> plus on s’eloigne de l’esperance, plus la proba est forte.
loglikminus <- function(theta){
mum <- theta[1]
sigmam <- theta[2]
pim <- theta[3]
-sum(log(dnorm(x, mum, sigmam) * pim + (1 - pim) * dunif(x, -a, a)))
}
On veut l’optimiser : optim()
optim(c(2, 2, 0.6), loglikminus)
NaNs producedNaNs producedNaNs producedNaNs producedNaNs produced
$par
[1] -0.03702247 0.84864558 0.86294999
$value
[1] 157.2963
$counts
function gradient
126 NA
$convergence
[1] 0
$message
NULL
Minus car optim minimise les differents problemes. Mais ne garantie pas que c’est un minimum global. De plus cela foncitonne uniquement car les dimensions sont faibles.
library(mclust)
__ ___________ __ _____________
/ |/ / ____/ / / / / / ___/_ __/
/ /|_/ / / / / / / / /\__ \ / /
/ / / / /___/ /___/ /_/ /___/ // /
/_/ /_/\____/_____/\____//____//_/ version 5.4.1
Type 'citation("mclust")' for citing this R package in publications.
data <- read.table("Wine-20181122/wine.txt")
data
Y <- data[-1]
head(Y)
Package Mclust :
res <- Mclust(data = Y, G = 3, modelNames = "EII")
fitting ...
|
| | 0%
|
|============================================================ | 50%
|
|=======================================================================================================================| 100%
res
'Mclust' model object: (EII,3)
Available components:
[1] "call" "data" "modelName" "n" "d" "G" "BIC"
[8] "bic" "loglik" "df" "hypvol" "parameters" "z" "classification"
[15] "uncertainty"
res\(G = meilleur melange res\)classification = quelles sont les classes obtenues ici
res$G
[1] 3
res$classification
[1] 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3 1 1 3 3 1 1 3 1 1 1 1 1 1 3 3 1 1 3 3 1 1 3 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 2
[63] 3 2 2 3 2 2 3 3 3 2 2 1 3 2 2 2 3 2 2 3 3 2 2 2 2 2 3 3 2 2 2 2 2 3 3 2 3 2 3 2 2 2 3 2 2 2 2 3 2 2 3 2 2 2 2 2 2 2 3 2 2 2
[125] 2 2 2 2 2 2 3 2 2 3 3 3 3 2 2 2 3 3 2 2 3 3 2 3 3 2 2 2 2 3 3 3 2 3 3 3 2 3 2 3 3 2 3 3 3 3 2 2 3 3 3 3 3 2
data$V1
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2
[63] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[125] 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
Difficiel de comparer les deux, choix du label independant. On utilise adjustedRandIndex pour savoir si des classifications sont proches ou pas
adjustedRandIndex(res$classification, data$V1)
[1] 0.3711137
Cet indice est inferieur a 1. PLus on se rapporche de 1, plus elles sont egales. (si =1, elles sont egales aux labels pres) Ici c’est pas terrible.
On ne se restreind pas sur le modele
res <- Mclust(data = Y, G = 3)
fitting ...
|
| | 0%
|
|======== | 7%
|
|================ | 13%
|
|======================== | 20%
|
|================================ | 27%
|
|======================================== | 33%
|
|================================================ | 40%
|
|======================================================== | 47%
|
|=============================================================== | 53%
|
|======================================================================= | 60%
|
|=============================================================================== | 67%
|
|======================================================================================= | 73%
|
|=============================================================================================== | 80%
|
|======================================================================================================= | 87%
|
|=============================================================================================================== | 93%
|
|=======================================================================================================================| 100%
res
'Mclust' model object: (VVE,3)
Available components:
[1] "call" "data" "modelName" "n" "d" "G" "BIC"
[8] "bic" "loglik" "df" "hypvol" "parameters" "z" "classification"
[15] "uncertainty"
res$classification
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2
[63] 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[125] 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
data$V1
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2
[63] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[125] 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
adjustedRandIndex(res$classification, data$V1)
[1] 0.9667411
res$modelName
[1] "VVE"
Si on a pas le nombnre de melange, on se base sur la complexite du modele par un Bic et le nombre de gaussienne. Ici on a des donnees de classes donc on est plus precis. Ici le meilleur modele est : ellipsoidale avec la meme orientation.
Independant du label
clas <- c("a", "b", "c")[res$classification]
clas
[1] "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a"
[32] "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "b" "b" "b"
[63] "b" "b" "b" "b" "b" "b" "b" "b" "c" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b"
[94] "b" "b" "b" "c" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b"
[125] "b" "b" "b" "b" "b" "b" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c"
[156] "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c" "c"
adjustedRandIndex(clas, data$V1)
[1] 0.9667411
On retrouve la meme valeur. L’index de rand marche aussi si le nombre d’ensemble dans 2 partitions sont differents
res <- Mclust(data = Y, G = 4)
fitting ...
|
| | 0%
|
|======== | 7%
|
|================ | 13%
|
|======================== | 20%
|
|================================ | 27%
|
|======================================== | 33%
|
|================================================ | 40%
|
|======================================================== | 47%
|
|=============================================================== | 53%
|
|======================================================================= | 60%
|
|=============================================================================== | 67%
|
|======================================================================================= | 73%
|
|=============================================================================================== | 80%
|
|======================================================================================================= | 87%
|
|=============================================================================================================== | 93%
|
|=======================================================================================================================| 100%
adjustedRandIndex(res$classification, data$V1)
[1] 0.8174383
plot(res, what = "BIC")
res <- Mclust(data = Y)
fitting ...
|
| | 0%
|
|= | 1%
|
|== | 2%
|
|=== | 2%
|
|==== | 3%
|
|===== | 4%
|
|====== | 5%
|
|======= | 6%
|
|======== | 7%
|
|========= | 8%
|
|========== | 9%
|
|=========== | 9%
|
|============ | 10%
|
|============= | 11%
|
|============== | 12%
|
|=============== | 13%
|
|================ | 13%
|
|================= | 14%
|
|================== | 15%
|
|=================== | 16%
|
|==================== | 17%
|
|===================== | 17%
|
|====================== | 18%
|
|====================== | 19%
|
|======================= | 20%
|
|======================== | 20%
|
|========================= | 21%
|
|========================== | 22%
|
|=========================== | 23%
|
|============================ | 24%
|
|============================= | 24%
|
|============================== | 25%
|
|=============================== | 26%
|
|================================ | 27%
|
|================================= | 28%
|
|================================== | 28%
|
|=================================== | 29%
|
|==================================== | 30%
|
|===================================== | 31%
|
|====================================== | 32%
|
|======================================= | 33%
|
|======================================== | 34%
|
|========================================= | 35%
|
|========================================== | 35%
|
|=========================================== | 36%
|
|============================================ | 37%
|
|============================================= | 38%
|
|============================================== | 39%
|
|=============================================== | 39%
|
|================================================ | 40%
|
|================================================= | 41%
|
|================================================== | 42%
|
|=================================================== | 43%
|
|==================================================== | 43%
|
|==================================================== | 44%
|
|===================================================== | 45%
|
|====================================================== | 46%
|
|======================================================= | 46%
|
|======================================================== | 47%
|
|========================================================= | 48%
|
|========================================================== | 49%
|
|=========================================================== | 50%
|
|============================================================ | 50%
|
|============================================================= | 51%
|
|============================================================== | 52%
|
|=============================================================== | 53%
|
|================================================================ | 54%
|
|================================================================= | 54%
|
|================================================================== | 55%
|
|=================================================================== | 56%
|
|=================================================================== | 57%
|
|==================================================================== | 57%
|
|===================================================================== | 58%
|
|====================================================================== | 59%
|
|======================================================================= | 60%
|
|======================================================================== | 61%
|
|========================================================================= | 61%
|
|========================================================================== | 62%
|
|=========================================================================== | 63%
|
|============================================================================ | 64%
|
|============================================================================= | 65%
|
|============================================================================== | 65%
|
|=============================================================================== | 66%
|
|================================================================================ | 67%
|
|================================================================================= | 68%
|
|================================================================================== | 69%
|
|=================================================================================== | 70%
|
|==================================================================================== | 71%
|
|===================================================================================== | 72%
|
|====================================================================================== | 72%
|
|======================================================================================= | 73%
|
|======================================================================================== | 74%
|
|========================================================================================= | 75%
|
|========================================================================================== | 76%
|
|=========================================================================================== | 76%
|
|============================================================================================ | 77%
|
|============================================================================================= | 78%
|
|============================================================================================== | 79%
|
|=============================================================================================== | 80%
|
|================================================================================================ | 80%
|
|================================================================================================= | 81%
|
|================================================================================================= | 82%
|
|================================================================================================== | 83%
|
|=================================================================================================== | 83%
|
|==================================================================================================== | 84%
|
|===================================================================================================== | 85%
|
|====================================================================================================== | 86%
|
|======================================================================================================= | 87%
|
|======================================================================================================== | 87%
|
|========================================================================================================= | 88%
|
|========================================================================================================== | 89%
|
|=========================================================================================================== | 90%
|
|============================================================================================================ | 91%
|
|============================================================================================================= | 91%
|
|============================================================================================================== | 92%
|
|=============================================================================================================== | 93%
|
|================================================================================================================ | 94%
|
|================================================================================================================= | 95%
|
|================================================================================================================== | 96%
|
|=================================================================================================================== | 97%
|
|==================================================================================================================== | 98%
|
|===================================================================================================================== | 98%
|
|====================================================================================================================== | 99%
|
|=======================================================================================================================| 100%
plot(res, what = "BIC")
plot(res, what = "classification")
plot(res, what = "density")
library(mclust)
data <- read.table("Seeds-20181122/seeds.txt")
head(data)
Y <- data[-8]
head(Y)
res <- Mclust(Y)
fitting ...
|
| | 0%
|
|= | 1%
|
|== | 2%
|
|=== | 2%
|
|==== | 3%
|
|===== | 4%
|
|====== | 5%
|
|======= | 6%
|
|======== | 7%
|
|========= | 8%
|
|========== | 9%
|
|=========== | 9%
|
|============ | 10%
|
|============= | 11%
|
|============== | 12%
|
|=============== | 13%
|
|================ | 13%
|
|================= | 14%
|
|================== | 15%
|
|=================== | 16%
|
|==================== | 17%
|
|===================== | 17%
|
|====================== | 18%
|
|====================== | 19%
|
|======================= | 20%
|
|======================== | 20%
|
|========================= | 21%
|
|========================== | 22%
|
|=========================== | 23%
|
|============================ | 24%
|
|============================= | 24%
|
|============================== | 25%
|
|=============================== | 26%
|
|================================ | 27%
|
|================================= | 28%
|
|================================== | 28%
|
|=================================== | 29%
|
|==================================== | 30%
|
|===================================== | 31%
|
|====================================== | 32%
|
|======================================= | 33%
|
|======================================== | 34%
|
|========================================= | 35%
|
|========================================== | 35%
|
|=========================================== | 36%
|
|============================================ | 37%
|
|============================================= | 38%
|
|============================================== | 39%
|
|=============================================== | 39%
|
|================================================ | 40%
|
|================================================= | 41%
|
|================================================== | 42%
|
|=================================================== | 43%
|
|==================================================== | 43%
|
|==================================================== | 44%
|
|===================================================== | 45%
|
|====================================================== | 46%
|
|======================================================= | 46%
|
|======================================================== | 47%
|
|========================================================= | 48%
|
|========================================================== | 49%
|
|=========================================================== | 50%
|
|============================================================ | 50%
|
|============================================================= | 51%
|
|============================================================== | 52%
|
|=============================================================== | 53%
|
|================================================================ | 54%
|
|================================================================= | 54%
|
|================================================================== | 55%
|
|=================================================================== | 56%
|
|=================================================================== | 57%
|
|==================================================================== | 57%
|
|===================================================================== | 58%
|
|====================================================================== | 59%
|
|======================================================================= | 60%
|
|======================================================================== | 61%
|
|========================================================================= | 61%
|
|========================================================================== | 62%
|
|=========================================================================== | 63%
|
|============================================================================ | 64%
|
|============================================================================= | 65%
|
|============================================================================== | 65%
|
|=============================================================================== | 66%
|
|================================================================================ | 67%
|
|================================================================================= | 68%
|
|================================================================================== | 69%
|
|=================================================================================== | 70%
|
|==================================================================================== | 71%
|
|===================================================================================== | 72%
|
|====================================================================================== | 72%
|
|======================================================================================= | 73%
|
|======================================================================================== | 74%
|
|========================================================================================= | 75%
|
|========================================================================================== | 76%
|
|=========================================================================================== | 76%
|
|============================================================================================ | 77%
|
|============================================================================================= | 78%
|
|============================================================================================== | 79%
|
|=============================================================================================== | 80%
|
|================================================================================================ | 80%
|
|================================================================================================= | 81%
|
|================================================================================================= | 82%
|
|================================================================================================== | 83%
|
|=================================================================================================== | 83%
|
|==================================================================================================== | 84%
|
|===================================================================================================== | 85%
|
|====================================================================================================== | 86%
|
|======================================================================================================= | 87%
|
|======================================================================================================== | 87%
|
|========================================================================================================= | 88%
|
|========================================================================================================== | 89%
|
|=========================================================================================================== | 90%
|
|============================================================================================================ | 91%
|
|============================================================================================================= | 91%
|
|============================================================================================================== | 92%
|
|=============================================================================================================== | 93%
|
|================================================================================================================ | 94%
|
|================================================================================================================= | 95%
|
|================================================================================================================== | 96%
|
|=================================================================================================================== | 97%
|
|==================================================================================================================== | 98%
|
|===================================================================================================================== | 98%
|
|====================================================================================================================== | 99%
|
|=======================================================================================================================| 100%
res$classification
[1] 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3 1 1 1 1 3 3 1 1 3 1 1 3 3 1 3 3 1 3 3 1 1 1 2 1 1 3 3 3 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 3 4 4
[63] 3 3 3 3 1 3 1 3 2 1 2 2 1 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2
[125] 1 2 2 2 2 2 2 2 1 1 1 1 2 1 1 1 3 3 3 3 4 4 4 3 3 4 4 4 4 4 4 4 4 4 4 4 3 3 4 3 4 3 3 3 4 4 4 4 4 4 4 4 4 4 4 3 4 3 3 4 3 4
[187] 4 4 4 4 4 4 3 4 3 3 3 3 3 3 3 3 4 3 3 3 4 3 4 3
adjustedRandIndex(res$classification, data$V8)
[1] 0.4813405
summary(res)
----------------------------------------------------
Gaussian finite mixture model fitted by EM algorithm
----------------------------------------------------
Mclust EEV (ellipsoidal, equal volume and shape) model with 4 components:
Clustering table:
1 2 3 4
59 56 53 42
res <- Mclust(Y, modelNames = "EEV")
fitting ...
|
| | 0%
|
|============ | 10%
|
|======================== | 20%
|
|==================================== | 30%
|
|================================================ | 40%
|
|============================================================ | 50%
|
|======================================================================= | 60%
|
|=================================================================================== | 70%
|
|=============================================================================================== | 80%
|
|=========================================================================================================== | 90%
|
|=======================================================================================================================| 100%
plot(res, what = "BIC")
plot(res, what = "classification")
plot(res, what = "density")
On a 3 classes en vrai mais on aurait besoin de 4 classes pour mieux decrire le jeu de donn??e
res <- Mclust(Y, G= 3)
fitting ...
|
| | 0%
|
|======== | 7%
|
|================ | 13%
|
|======================== | 20%
|
|================================ | 27%
|
|======================================== | 33%
|
|================================================ | 40%
|
|======================================================== | 47%
|
|=============================================================== | 53%
|
|======================================================================= | 60%
|
|=============================================================================== | 67%
|
|======================================================================================= | 73%
|
|=============================================================================================== | 80%
|
|======================================================================================================= | 87%
|
|=============================================================================================================== | 93%
|
|=======================================================================================================================| 100%
res$classification
[1] 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 1 3 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3
[63] 3 1 1 1 1 1 1 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[125] 2 2 2 2 2 2 2 2 1 2 1 1 2 1 1 2 3 1 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
[187] 3 3 3 3 3 3 3 3 3 3 3 1 3 3 3 1 3 3 3 3 3 1 3 3
adjustedRandIndex(res$classification, data$V8)
[1] 0.7373941
summary(res)
----------------------------------------------------
Gaussian finite mixture model fitted by EM algorithm
----------------------------------------------------
Mclust VEV (ellipsoidal, equal shape) model with 3 components:
Clustering table:
1 2 3
70 69 71
res <- Mclust(Y)
fitting ...
|
| | 0%
|
|= | 1%
|
|== | 2%
|
|=== | 2%
|
|==== | 3%
|
|===== | 4%
|
|====== | 5%
|
|======= | 6%
|
|======== | 7%
|
|========= | 8%
|
|========== | 9%
|
|=========== | 9%
|
|============ | 10%
|
|============= | 11%
|
|============== | 12%
|
|=============== | 13%
|
|================ | 13%
|
|================= | 14%
|
|================== | 15%
|
|=================== | 16%
|
|==================== | 17%
|
|===================== | 17%
|
|====================== | 18%
|
|====================== | 19%
|
|======================= | 20%
|
|======================== | 20%
|
|========================= | 21%
|
|========================== | 22%
|
|=========================== | 23%
|
|============================ | 24%
|
|============================= | 24%
|
|============================== | 25%
|
|=============================== | 26%
|
|================================ | 27%
|
|================================= | 28%
|
|================================== | 28%
|
|=================================== | 29%
|
|==================================== | 30%
|
|===================================== | 31%
|
|====================================== | 32%
|
|======================================= | 33%
|
|======================================== | 34%
|
|========================================= | 35%
|
|========================================== | 35%
|
|=========================================== | 36%
|
|============================================ | 37%
|
|============================================= | 38%
|
|============================================== | 39%
|
|=============================================== | 39%
|
|================================================ | 40%
|
|================================================= | 41%
|
|================================================== | 42%
|
|=================================================== | 43%
|
|==================================================== | 43%
|
|==================================================== | 44%
|
|===================================================== | 45%
|
|====================================================== | 46%
|
|======================================================= | 46%
|
|======================================================== | 47%
|
|========================================================= | 48%
|
|========================================================== | 49%
|
|=========================================================== | 50%
|
|============================================================ | 50%
|
|============================================================= | 51%
|
|============================================================== | 52%
|
|=============================================================== | 53%
|
|================================================================ | 54%
|
|================================================================= | 54%
|
|================================================================== | 55%
|
|=================================================================== | 56%
|
|=================================================================== | 57%
|
|==================================================================== | 57%
|
|===================================================================== | 58%
|
|====================================================================== | 59%
|
|======================================================================= | 60%
|
|======================================================================== | 61%
|
|========================================================================= | 61%
|
|========================================================================== | 62%
|
|=========================================================================== | 63%
|
|============================================================================ | 64%
|
|============================================================================= | 65%
|
|============================================================================== | 65%
|
|=============================================================================== | 66%
|
|================================================================================ | 67%
|
|================================================================================= | 68%
|
|================================================================================== | 69%
|
|=================================================================================== | 70%
|
|==================================================================================== | 71%
|
|===================================================================================== | 72%
|
|====================================================================================== | 72%
|
|======================================================================================= | 73%
|
|======================================================================================== | 74%
|
|========================================================================================= | 75%
|
|========================================================================================== | 76%
|
|=========================================================================================== | 76%
|
|============================================================================================ | 77%
|
|============================================================================================= | 78%
|
|============================================================================================== | 79%
|
|=============================================================================================== | 80%
|
|================================================================================================ | 80%
|
|================================================================================================= | 81%
|
|================================================================================================= | 82%
|
|================================================================================================== | 83%
|
|=================================================================================================== | 83%
|
|==================================================================================================== | 84%
|
|===================================================================================================== | 85%
|
|====================================================================================================== | 86%
|
|======================================================================================================= | 87%
|
|======================================================================================================== | 87%
|
|========================================================================================================= | 88%
|
|========================================================================================================== | 89%
|
|=========================================================================================================== | 90%
|
|============================================================================================================ | 91%
|
|============================================================================================================= | 91%
|
|============================================================================================================== | 92%
|
|=============================================================================================================== | 93%
|
|================================================================================================================ | 94%
|
|================================================================================================================= | 95%
|
|================================================================================================================== | 96%
|
|=================================================================================================================== | 97%
|
|==================================================================================================================== | 98%
|
|===================================================================================================================== | 98%
|
|====================================================================================================================== | 99%
|
|=======================================================================================================================| 100%
res$G
[1] 5
res$modelName
[1] "VVE"
res$classification
[1] 1 1 1 3 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1
[63] 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 2 1 1 3 1 2 3 1 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1
[125] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 4 4 5 4 4 4 5 4 4 4 4 4 4 4 4 5 4 4 4 4 5 4 4 4 4 4 4 4 4 4 4 5 4 4 4 4 5 4 1 4 4
[187] 4 5 4 2 4 4 4 4 5 4 4 4 4 4 4 4 4 4 4 4 5 5 4 4 4 4 2 2 2 2 2 2 5 4 2 4 3 4 4 4 4 4 5 4 4 4 4 4 4 4 5 5 5 4 4 4 4 4 4 4 5 4
[249] 4 4 4 4 5 2 4 4 5 2 5 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 3 2 3 3 3 3 3 3 3
[311] 3 3 3 3 4 3 3 3 3 3 3 3 3 3 3 1 3 3 3 3 1 3 3 3 3 3
adjustedRandIndex(res$classification, data$V9)
[1] 0.6177186
plot(res, what = "BIC")
plot(res, what = "classification")
plot(res, what = "density")
Si on regarde la matrice de variance co-variance des variable 4 et 5, elles devraient etre toute petite
data$V4
[1] 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48
[25] 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48
[49] 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48
[73] 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48
[97] 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48
[121] 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48
[145] 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48
[169] 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 1.00 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48
[193] 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48
[217] 0.48 0.48 0.48 0.48 0.48 0.48 1.00 1.00 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48
[241] 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 1.00 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48
[265] 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 1.00 0.48 0.48 0.48 0.48 1.00 1.00 1.00 1.00 1.00 0.48 0.48 0.48 0.48
[289] 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48
[313] 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48 0.48